package cn.dong.edu.controller.admin;


import cn.dong.edu.service.impl.AdminServiceImpl;
import cn.dong.api.domain.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 登录 前端控制器
 * </p>
 *
 * @author You-Dong
 * @since 2021-02-01
 */
@RestController
@RequestMapping("/edu/admin")
public class AdminController {

    @Autowired
    private AdminServiceImpl adminService;

    /**
     * 模拟登录
     * @return
     */
    @PostMapping("/login")
    public CommonResult login(@RequestParam(name = "username") String username,
                              @RequestParam(name = "password") String password){
//        QueryWrapper<Admin> wrapper = new QueryWrapper<Admin>();
//        wrapper.eq("username", "username");
//        wrapper.eq("password", "password");
//        Admin one = adminService.getOne(wrapper);
//        if (one == null) {
//            return CommonResult.error().message("用户名或密码有误!");
//        }
//        Map<String, String> map = new HashMap<String, String>();
//        map.put("token", one.getUsername());
        return CommonResult.ok();
    }
    /**
     * 获取信息
     * @return
     */
    @GetMapping("/getInfo")
    public CommonResult getInfo(){
     return CommonResult.ok().data("'roles':['admin'],'name':'admin','avatar':'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'}");
    }


}

